package com.icinfo.cloud.provider.punish.evideinv.enums;

import com.icinfo.cloud.provider.punish.config.enums.FastCaseMattersTemplateTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @author shishengyao
 * @description
 * @date 2023/9/5
 */
@AllArgsConstructor
@NoArgsConstructor
public enum EvidenceOperateTypeEnum {
    /**
     * 证据类型:
     * 01:书证，
     * 02:物证，
     * 03:视听资料，
     * 04:电子数据，
     * 05:笔录（0501:调查（询问）笔录，0502:现场勘验（检查）笔录，0503:陈述申辩笔录，0504:听证笔录，0505:行政强制措施现场笔录，0506:行政强制执行现场笔录），
     * 06:文书（0601:法律文书，0602:审批表），
     * 07 :鉴定意见，
     * 08:现场勘验（0801:现场照片，0802:现场勘验图），
     * 99:其他
     */
    /**
     * 书证新增        bookEvidence_add
     * 物证新增        physicalEvidence_add
     * 电子数据新增        electronicEvidence_add
     * 视听资料新增        audioVisualEvidence_add
     * 现场勘验图新增        figure_add
     * 现场照片新增        photo_add
     * 其它证据新增        appendix_add
     * 鉴定意见编辑        expertOpinion_add
     * 证照新增        licenseEvidence_add
     * 调查（询问）笔录 inquiry_record
     * 现场勘验笔录  on_site_inspection_record
     */

    T00("0501","调查（询问）笔录","inquiry_record",FastCaseMattersTemplateTypeEnum.T00.getCode()),
    T01("0502","现场勘验（检查）笔录","on_site_inspection_record",FastCaseMattersTemplateTypeEnum.T01.getCode()),
    T02("0801","现场照片","photo_add",FastCaseMattersTemplateTypeEnum.T03.getCode()),
    T03("0802","现场勘验图","figure_add",FastCaseMattersTemplateTypeEnum.T02.getCode()),
    T04("99","其他","appendix_add",FastCaseMattersTemplateTypeEnum.T04.getCode());

    private String code;

    private String name;
    @Getter
    private String linkType;
    @Getter
    private String documentKindCode;
    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 根据类型返回name
     *
     * @param code 类型
     */
    public static String getNameByCode(String code) {
        for (EvidenceOperateTypeEnum item : EvidenceOperateTypeEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getName();
            }
        }
        return null;
    }
    public static String getCodeeByDocumentKindCode(String code) {
        for (EvidenceOperateTypeEnum item : EvidenceOperateTypeEnum.values()) {
            if (item.getDocumentKindCode().equals(code)) {
                return item.getCode();
            }
        }
        return null;
    }
    public static String getLinkTypeByDocumentKindCode(String documentKindCode) {
        for (EvidenceOperateTypeEnum item : EvidenceOperateTypeEnum.values()) {
            if (item.getDocumentKindCode().equals(documentKindCode)) {
                return item.getLinkType();
            }
        }
        return null;
    }
    /**
     * 通过code取枚举
     *
     * @param code
     * @return
     */
    public static EvidenceOperateTypeEnum getTypeByCode(String code) {
        if (null == code) {
            return null;
        }
        for (EvidenceOperateTypeEnum enums : EvidenceOperateTypeEnum.values()) {
            if (enums.getCode().equals(code)) {
                return enums;
            }
        }
        return null;
    }
}
